package goods;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class GoodsDataRead{
    private static GoodsDAOArrayList goodsData = new GoodsDAOArrayList();
    public static void main() throws NullPointerException{
        try {
            BufferedReader in;
            in = new BufferedReader(
                    new InputStreamReader(
                            new FileInputStream("商品数据.txt"), StandardCharsets.UTF_8));
            String line;
            while((line = in.readLine()) != null){
                    String[] tempBufferString = line.split(" ");
                    Goods goods = new Goods(tempBufferString[0],tempBufferString[1],tempBufferString[2],tempBufferString[3],tempBufferString[4]);
                    goodsData.addGoods(goods);
                }
            }  catch (IOException ex) {
            ex.printStackTrace();
        }

    }

    public GoodsDAOArrayList getGoodsData() {
        return goodsData;
    }
}
